//
//  PlaceCollectionViewCell.m
//  HappinessTrip
//
//  Created by dllo on 15/10/6.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "PlaceCollectionViewCell.h"
#import "UIImageView+WebCache.h"
#import "Fit.h"

@implementation PlaceCollectionViewCell
-(void)dealloc
{
    [_imageView release];
    [_blackImageView release];
    [_nameLabel release];
    [super dealloc];
}
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createViews];
    }
    return self;
}
-(void)createViews
{
    _imageView = [[UIImageView alloc]init];
    [self.contentView addSubview:_imageView];
    [_imageView release];
    _blackImageView = [[UIImageView alloc]init];
    [_imageView addSubview:_blackImageView];
    [_blackImageView release];
    _nameLabel = [[UILabel alloc]init];
    [_imageView addSubview:_nameLabel];
    [_nameLabel release];
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    _imageView.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.frame.size.height);
    _blackImageView.frame = CGRectMake(0, 0, _imageView.frame.size.width, _imageView.frame.size.height);
    _nameLabel.frame = CGRectMake(20 * W, 180 * H, _imageView.frame.size.width - 20 * W, 20 * H);
}
-(void)setData:(RecommendData *)data
{
    if (_data != data) {
        [_data release];
        _data = [data retain];
    }
    [_imageView sd_setImageWithURL:[NSURL URLWithString:_data.cover_s] placeholderImage:[UIImage imageNamed:@"dengdai"]];
    _imageView.layer.masksToBounds = YES;
    _imageView.layer.cornerRadius = 10;
    _blackImageView.backgroundColor = [UIColor blackColor];
    _blackImageView.alpha = .2;
    _blackImageView.layer.cornerRadius = 10;
    _blackImageView.layer.masksToBounds = YES;
    _nameLabel.text = _data.name;
    _nameLabel.textColor = [UIColor whiteColor];
}










@end
